package mc.support.crawler;

/**
 * Created with IntelliJ IDEA. <br/>
 * User: francis    <br/>
 * Date: 13-11-7    <br/>
 * Time: 17:07  <br/>
 */
public class CrawlRequest {

    private final String nick;
    private final String sessionKey;
    private final String keyword;
    private final SourceType sourceType;
    private final SortType sortType;
    private final int beginPage;
    private final int offset;

    public CrawlRequest(String nick,String sessionKey, String keyword, SortType sortType,SourceType sourceType,
                        int beginPage, int offset) {
        this.nick = nick;
        this.sessionKey = sessionKey;
        this.keyword = keyword;
        this.sortType = sortType;
        this.sourceType = sourceType;
        this.beginPage = beginPage;
        this.offset = offset;
    }

    public String getSessionKey() {
        return sessionKey;
    }

    public String getKeyword() {
        return keyword;
    }

    public SourceType getSourceType() {
        return sourceType;
    }

    public SortType getSortType() {
        return sortType;
    }

    public int getBeginPage() {
        return beginPage;
    }

    public int getOffset() {
        return offset;
    }

    public String getNick() {
        return nick;
    }

    public static class Builder {

        private String nick;
        private String sessionKey;
        private String keyword;
        private SortType sortType;
        private SourceType sourceType;
        private int beginPage;
        private int offset;


        public Builder nick(String nick) {
            this.nick = nick;
            return this;
        }
        public Builder sessionKey(String sessionKey) {
            this.sessionKey = sessionKey;
            return this;
        }

        public Builder keyword(String keyword) {
            this.keyword = keyword;
            return this;
        }

        public Builder sortType(SortType sortType) {
            this.sortType = sortType;
            return this;
        }

        public Builder sourceType(SourceType sourceType) {
            this.sourceType = sourceType;
            return this;
        }

        public Builder beginPage(int beginPage) {
            this.beginPage = beginPage;
            return this;
        }

        public Builder offset(int offset) {
            this.offset = offset;
            return this;
        }

        public CrawlRequest build() {
            return new CrawlRequest(nick, sessionKey, keyword, sortType,sourceType,
                    beginPage, offset );
        }

    }

}